#include <stdio.h>
#include <time.h>
#include <ctime>
#include <stdlib.h>
#include <map>

using namespace std;

int findIncreasingLen(int* v, int start, int sz){

	int inc = 0;
	for(int i=start; i < sz; i++){
		if(v[i] < v[i+1]){
			inc++;
		}else{break;}
	}
	return inc;
}

void getMap(int* v, int sz){
	map<int, int> lenMap;
	map<int, int>::iterator itr;

	for(int i = 0; i < sz; i++){
		lenMap[i] = findIncreasingLen(v, i, sz);
	}
	
	int maxIndex = 0;
	int maxInc = 0;
	for(itr = lenMap.begin(); itr != lenMap.end(); itr++){
		printf("%d : %d \n" , (*itr).first,  (*itr).second);
		if(maxInc < (*itr).second){
			maxIndex = (*itr).first;
			maxInc = (*itr).second;
		}
	}

	printf("max index = %d with %d elements\n", maxIndex, maxInc);
}

int main(){

	srand((unsigned)time(0)); 
	const int arraySize = 30;
	int v[arraySize];
	for(int i =0; i < arraySize; i++){
		v[i] = rand() % 100;
		printf("%d ", v[i]);
	}
	printf("\n");

	getMap(v, arraySize);
	return 0;
}
